<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<html>
<head>
<title>文件设置</title>
<%@ include file="/WEB-INF/jsp/public/common.jspf"%>
<link type="text/css" rel="stylesheet"
	href="${pageContext.request.contextPath}/style/blue/file.css" />
<script
	src="${pageContext.request.contextPath}/script/tree/jquery.treeview.js"></script>
<script
	src="${pageContext.request.contextPath}/script/tree/jquery.cookie.js"></script>
	<script language="javascript" src="${pageContext.request.contextPath}/fckeditor/fckeditor.js" charset="utf-8"></script>
</head>
<script type="text/javascript">
$(document).ready(function (){
	var type=document.getElementsByName("type")[0].value;
	if(type==0){
		$("#publish").show();
	}
			// 指定事件处理函数
			$("[name=knowTypeIds]").click(function(){
				
				// 当选中或取消一个权限时，也同时选中或取消所有的下级权限
				$(this).siblings("ul").find("input").prop("checked", this.checked);
				
				// 当选中一个权限时，也要选中所有的直接上级权限
				if(this.checked == true){
					$(this).parents("li").children("input").prop("checked", true);
				}
				
			});
		});
		$(function(){
				var fck = new FCKeditor("content");
				fck.Width = "99%";
				fck.Height = "500px";
				fck.ToolbarSet = "bbs";
				fck.BasePath = "${pageContext.request.contextPath}/fckeditor/";
				//fck.Config['SkinPath'] = "${pageContext.request.contextPath}/scriipt/fckeditoreditor/skins/office2003/";
				//fck.Config['SkinPath'] = "http://bbs.itcast.cn:80/widgets/fckeditor/editor/skins/office2003/";
				fck.ReplaceTextarea();
			});
		function a(){
 			var type=document.getElementsByName("type")[0].value;
 			var textname=document.getElementsByName("textname")[0].value;		
 			if(type==0){
 				if(textname.length<1){
 					alert("文章标题与内容不能为空！");
 	 				return false;
 				}
 			}
 			document.form.submit();
 			return true;
 			
 		}
	</script>
<body>

	<div id="Title_bar">
		<div id="Title_bar_Head">
			<div id="Title_Head"></div>
			<div id="Title">
				<!--页面标题-->
				<img border="0" width="13" height="13"
					src="${pageContext.request.contextPath}/style/images/title_arrow.gif" />
				修改文件
			</div>
			<div id="Title_End"></div>
		</div>
	</div>

	<!--显示表单内容-->
	<div id=MainArea>

		<s:form action="rdfile_edit" name="form">
			<s:hidden name="id"></s:hidden>
            <s:hidden name="type"></s:hidden>
			<div class="ItemBlock_Title1">
				<!-- 信息说明 -->
				<div class="ItemBlock_Title1">
					<img border="0" width="4" height="7"
						src="${pageContext.request.contextPath}/style/blue/images/item_point.gif" />
					修改文件
				</div>
			</div>

			<!-- 表单内容显示 -->
			<div class="ItemBlockBorder">
				<div class="ItemBlock">
					<table cellpadding="0" cellspacing="0" class="mainForm">
						<!--表头-->


						<!--显示数据列表-->
						<tbody id="TableData">
							<tr>
								<td width="60px">说明</td>
								<td><s:textarea name="remark" cssClass="TextareaStyle"></s:textarea></td>
							</tr>
							<tr align="LEFT" valign="MIDDLE" id="TableTitle">
								<td width="60px">修改知识类型</td>
								<td width="300px" style="padding-left: 7px;">
									<!-- 如果把全选元素的id指定为selectAll，并且有函数selectAll()，就会有错。因为有一种用法：可以直接用id引用元素 -->
									<input type="checkbox" id="cbSelectAll"
									onClick="$('[name=knowTypeIds]').attr('checked', this.checked)" />
									<label for="cbSelectAll">全选</label>
								</td>
							</tr>

							<tr id="TableTitle">
								<td width="60px"></td>
								<td>


									<ul id="tree">
										<s:iterator value="#knowTypeList">
											<li><input type="checkbox" name="knowTypeIds"
												value="${id}" id="cb_${id}"
												<s:property value="%{id in knowTypeIds ? 'checked' : ''}"/> />
												<label for="cb_${id}">${name}</label>
												<ul>
													<s:iterator value="children">
														<li><input type="checkbox" name="knowTypeIds"
															value="${id}" id="cb_${id}"
															<s:property value="%{id in knowTypeIds ? 'checked' : ''}"/> />
															<label for="cb_${id}">${name}</label>
															<ul>
												        	<s:iterator value="children">
													        	<li><input type="checkbox" name="knowTypeIds" value="${id}" id="cb_${id}"
															<s:property value="%{id in knowTypeIds ? 'checked' : ''}"/> />
															<label for="cb_${id}">${name}</label>
													     	</li>
												        	</s:iterator>
												</ul>
														</li>
													</s:iterator>
												</ul>
												</li>
										</s:iterator>
									</ul>


								</td>
							</tr>
						</tbody>


					</table>
				</div>
			</div>

			<script language="javascript">
        	$("#tree").treeview();
        </script>
          <div id="PageHead"></div>
		<center>
			
			<div id="publish" style="display:none;">
				<table border="0" cellspacing="1" cellpadding="1" width="100%" id="InputArea" >
				<tr>
						<td class="InputAreaBg" height="30" width="50px"><div class="InputTitle">标题</div></td>
						<td class="InputAreaBg"><div class="InputContent">
							<s:textfield name="textname" cssClass="InputStyle" cssStyle="text-align:center;width:250px;height:25px;font-weight:bold;color:red;font-size:20px;"/>
							</div>
						</td>
					</tr>
					<tr height="600">
						<td class="InputAreaBg"><div class="InputTitle">内容</div></td>
						<td class="InputAreaBg" cssStyle="height:500px">
							<div class="InputContent">
								<s:textarea name="content" cssStyle="width:650px;height:500px"></s:textarea>
							</div>
						</td>
						
					</tr>					
				</table>
			</div>
		</center>
			<!-- 表单操作 -->
			<div id="InputDetailBar">
				<img src="${pageContext.request.contextPath}/style/images/save.png"  onclick="a();"/> 
					<a href="javascript:history.go(-1);"><img	src="${pageContext.request.contextPath}/style/images/goBack.png" /></a>
			</div>
		</s:form>
	</div>



</body>
</html>

